<template>
  <div>
    <svg :style="{ width: size, height: size }">
      <use :xlink:href="prefix + name" :fill="color"></use>
    </svg>
  </div>
</template>

<script setup lang="ts">
// 接收父组件传过来的参数
defineProps({
  prefix: {
    // xlink:href属性的前缀
    type: String,
    default: '#icon-',
  },
  name: {
    // 名字的属性
    type: String,
    required: true,
  },
  color: {
    type: String,
    default: '#777',
  },
  size: {
    type: String,
    default: '16px',
  },
})
</script>

<style lang="scss" scoped></style>
